package cn.song;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import java.io.File;

/**
 * 请求转发应用程序
 *
 * @author SongRenShuo
 * @date 2025/02/12
 */
@Slf4j
@SpringBootApplication
public class RequestForwardingApplication {

    public static void main(String[] args) {
        SpringApplication.run(RequestForwardingApplication.class, args);
    }


    @Value("${logging.file.path}")
    private  String logPath;

    /**
     * 自动创建日志目录
     *
     * @date 2025/02/12
     * @author SongRenShuo
     */
    @PostConstruct
    public void createCatalog() {
        // 如果目录不存在就创建
        boolean mkdir = new File(logPath).mkdirs();
        if (mkdir) {
            log.info("自动创建目录成功:{}",logPath);
        }
    }

}
